@import '../stakingConfig';
@import '../../../themes/mixins/link';

$tooltip-width: 280px;

.component {
  @extend %regularText;
  background: var(--theme-staking-stake-pool-tooltip-background-color);
  border-radius: 5px;
  padding: 10px;
  text-align: initial;
  user-select: text;
  width: $tooltip-width;
  z-index: 1000;

  :global {
    span.SimpleLink_root {
      font-size: var(--rp-button-font-size);
    }
    button.SimpleButton_root {
      background-color: var(
        --theme-staking-stake-pool-tooltip-delegate-button-background-color
      );
      border: 1px solid
        var(--theme-staking-stake-pool-tooltip-delegate-button-border-color);
      border-radius: 2px;
      color: var(--theme-staking-stake-pool-tooltip-delegate-button-text-color);
      height: 33px;
      margin-top: 14px;
      user-select: none;
      width: 100%;

      &:hover {
        background-color: var(
          --theme-staking-stake-pool-tooltip-delegate-button-hover-background-color,
          --rp-button-bg-color-hover
        );
        color: var(
          --theme-staking-stake-pool-tooltip-delegate-button-inverse-text-color
        );
      }

      &:active {
        background-color: var(
          --theme-staking-stake-pool-tooltip-delegate-button-active-background-color
        );
        border: none;
        color: var(
          --theme-staking-stake-pool-tooltip-delegate-button-inverse-text-color
        );
      }
    }

    .TooltipPool_container > span {
      outline: none;
    }
  }

  .iconButton {
    cursor: pointer;
  }

  .noDataDash {
    background-color: var(--theme-staking-stake-pool-grey-bg-color);
    border-radius: 3px;
    display: inline-block;
    height: 16px;
    width: 23px;

    :global {
      .SVGInline {
        align-items: center;
        display: flex !important;
        justify-content: center;
        padding: 0 4px !important;
      }
    }

    svg {
      height: 10px;
      width: 7px;

      path {
        fill: var(--theme-staking-stake-pool-tooltip-neutral-text-color);
      }
    }
  }

  .noDataDashTooltip {
    padding: 0;
  }
}

.container {
  padding: 10px 10px 0;
}

.colorBand {
  border-radius: 4px 4px 0 0;
  display: block;
  height: 5px;
  left: 0;
  position: absolute;
  top: 0;
  width: 100%;
}

.greyColorBand {
  background: var(--theme-staking-stake-pool-grey-color);
}

.homepage {
  width: initial;
}

.id {
  color: var(--theme-staking-stake-pool-tooltip-text-color);
  cursor: pointer;
  font-family: var(--font-medium);
  font-size: 10px;
  height: 14px;
  line-height: 14px;
  margin: -8px 0 12px;
  padding: 3px 0;
  transition: margin 0.4s ease-in-out;
  word-break: break-all;

  .ellipsisContent {
    opacity: 0.5;
    overflow: hidden;
    padding-top: 3px;
    position: absolute;
    transition: opacity 0s;
    transition-delay: 0s;
    white-space: nowrap;
  }

  .hoverContent {
    background: var(--theme-staking-stake-pool-tooltip-background-color);
    height: 20px;
    left: 0;
    opacity: 0;
    position: absolute;
    right: 0;
    transition: opacity 0.25s, height 0.25s;
    transition-delay: 0s;
    user-select: none;
    width: $tooltip-width;

    .hoverContentBackground {
      background: var(--theme-staking-stake-pool-tooltip-id-background-color);
      box-shadow: 0 2px 5px var(--theme-staking-stake-pool-tooltip-id-shadow-1);
      height: 100%;
      padding: 3px 20px 5px;
      width: 100%;
    }

    svg {
      margin-left: 3px;
    }

    &.copyIcon {
      svg {
        height: 9.5px;
        width: 8px;

        path {
          fill: var(--theme-staking-stake-pool-tooltip-text-color);
        }
      }
    }

    &.checkIcon {
      svg {
        height: 8px;
        width: auto;

        path {
          stroke: var(--theme-staking-stake-pool-tooltip-text-color);
        }
      }
    }
  }

  &:hover {
    .ellipsisContent {
      opacity: 0;
      transition-delay: 0.25s;
    }

    .hoverContent {
      height: 36px;
      margin-left: 0;
      opacity: 1;
      transition: opacity 0s, height 0.25s;
      transition-delay: 0.25s;
    }
  }
}

.name {
  color: var(--theme-staking-stake-pool-tooltip-text-color);
  font-family: var(--font-semibold);
  font-size: 16px;
  letter-spacing: 0.5px;
  line-height: 1.38;
  margin-bottom: 3px;
  max-height: 44px;
  overflow: hidden;
  padding-right: 25px;
  text-overflow: ellipsis;
}

.closeButton {
  cursor: pointer;
  position: absolute;
  right: 20px;
  top: 25px;

  svg {
    height: 8px;
    width: 8px;

    polygon {
      fill: var(--theme-staking-stake-pool-tooltip-text-color);
    }
  }
}

.ticker {
  color: var(--theme-staking-stake-pool-tooltip-text-color);
  display: inline-block;
  line-height: 1.36;
  margin-bottom: 9px;
  opacity: 0.6;
  vertical-align: middle;
  @extend %stakePoolTicker;
}

.retirement {
  background: var(
    --theme-staking-stake-pool-tooltip-retirement-background-color
  );
  border-radius: 3px;
  color: var(--theme-staking-stake-pool-tooltip-retirement-text-color);
  display: inline-block;
  font-size: 10px;
  margin-bottom: 9px;
  margin-left: 8px;
  padding: 3px 9px;
  vertical-align: middle;
}

.description {
  color: var(--theme-staking-stake-pool-tooltip-text-color);
  font-size: 14px;
  line-height: 1.36;
  margin-bottom: 4px;
  max-height: 57px;
  overflow-y: auto;
  padding-right: 6px;
  word-break: break-word;

  &::-webkit-scrollbar {
    width: 4px;
  }

  &::-webkit-scrollbar-button {
    display: block;
    height: 3px;
  }

  &::-webkit-scrollbar-thumb {
    border: none;
  }
}

.table {
  @extend %regularText;
  margin: 18px 0 6px 0;

  .dRow {
    align-items: center;
    display: flex;
    justify-content: space-between;

    &:hover {
      & > div:first-child {
        .questionMark {
          display: block;
        }
      }
    }

    & > div {
      height: 19px;
      margin-bottom: 6px;
      white-space: nowrap;
    }

    & > div:first-child {
      align-items: center;
      color: var(--theme-staking-stake-pool-tooltip-table-title-color);
      display: flex;
      font-size: 14px;
      line-height: 1.36;
      width: 65%;

      &.saturationLabel {
        width: 50%;
      }

      &.costPerEpochLabel {
        width: 75%;
      }

      .labelContainer {
        align-items: center;
        cursor: pointer;
        display: flex;

        &:hover {
          .questionMark {
            :global {
              .SVGInline {
                svg {
                  path {
                    opacity: 0.5;
                  }
                }
              }
            }
          }
        }
      }

      .fieldLabel {
        line-height: 1;
        margin-right: 4px;
        opacity: 0.8;
      }

      .questionMark {
        display: none;
        height: 19px;
        width: 10px;

        :global {
          .SVGInline {
            align-items: center;
            display: flex;
            height: 100%;
            justify-content: center;
            line-height: 19px;
            width: 100%;

            svg {
              height: 10px;
              width: 10px;

              path {
                fill: var(--theme-staking-stake-pool-tooltip-table-title-color);
                opacity: 0.3;
              }
            }
          }
        }
      }

      .tooltipWithHtmlContent {
        p {
          -webkit-box-orient: horizontal;
          display: block;
          -webkit-line-clamp: none;
          overflow: visible;
          text-overflow: clip;
          word-break: normal;

          & + p {
            margin-top: 6px;
          }
        }
      }
    }

    & > div:last-child {
      line-height: 0;
      padding-top: 1px;
      text-align: right;
      width: 35%;

      &.costValue {
        width: 25%;
      }

      span {
        border-radius: 3px;
        color: var(--theme-staking-stake-pool-tooltip-table-param-color);
        display: inline-block;
        font-size: 8px;
        font-weight: bold;
        height: 16px;
        line-height: 16px;
        padding: 0 9px;
      }

      &.saturationValue {
        width: 50% !important;

        & > span {
          background: var(
            --theme-staking-stake-pool-tooltip-neutral-background-color
          );
          white-space: nowrap;

          .saturationBar {
            background: var(
              --theme-staking-stake-pool-saturation-background-color
            );
            border-radius: 2px;
            height: 5px;
            margin: 0 6px 0 0;
            overflow: hidden;
            padding: 0;
            position: relative;
            width: 40px;

            span {
              border-radius: 2px;
              bottom: 0;
              height: inherit;
              left: 0;
              padding: 0;
              position: absolute;
              top: 0;
            }

            &.green span {
              background: var(
                --theme-staking-stake-pool-saturation-green-color
              );
            }

            &.orange span {
              background: var(
                --theme-staking-stake-pool-saturation-orange-color
              );
            }

            &.red span {
              background: var(--theme-staking-stake-pool-saturation-red-color);
            }

            &.yellow span {
              background: var(
                --theme-staking-stake-pool-saturation-yellow-color
              );
            }
          }
        }
      }
    }
  }

  .ranking {
    position: relative;

    .asterisk {
      font-family: Verdana;
      padding: 0 !important;
    }
  }
}

.defaultColorContent {
  background: var(--theme-staking-stake-pool-tooltip-neutral-background-color);
  color: var(--theme-staking-stake-pool-tooltip-neutral-text-color);
}
